<?php include 'login/Restrito.php';?>
<script language="JavaScript" type="text/javascript">
   function mascaraCpf(campoCpf){
              var cpf = campoCpf.value;
              if (cpf.length == 3){
                  cpf = cpf + '.';
                  document.forms[0].cpf.value = cpf;
      				return true;              
              }
              if (cpf.length == 7){
                  cpf = cpf + '.';
                  document.forms[0].cpf.value = cpf;
                  return true;
              }
			  if (cpf.length == 11){
                  cpf = cpf + '-';
                  document.forms[0].cpf.value = cpf;
                  return true;
              }
         }
   function mascaraRG(campoRG){
       var rg = campoRG.value;
       if (rg.length == 3){
           rg = rg + '.';
           document.forms[0].rg.value = rg;
				return true;              
       }
       if (rg.length == 7){
           rg = rg + '.';
           document.forms[0].rg.value = rg;
           return true;
       }
  }
	function caractereTelefone(campoTel){
              var telefone = campoTel.value;
              if (telefone.length == 3){
                  telefone = telefone + ')';
                  document.forms[0].fone.value = telefone;
      				return true;              
              }
              if (telefone.length == 8){
                  telefone = telefone + '-';
                  document.forms[0].fone.value = telefone;
                  return true;
              }
			  
         }
	function caractereCelular(campoCel){
        var celular = campoCel.value;
        if (celular.length == 3){
            celular = celular + ')';
            document.forms[0].celular.value = celular;
				return true;              
        }
        if (celular.length == 8){
            celular = celular + '-';
            document.forms[0].celular.value = celular;
            return true;
        }
		  
   }
	function caractereData(campoData){
        var data = campoData.value;
        if (data.length == 2){
            data = data + '/';
            document.forms[0].datanasc.value = data;
				return true;              
        }
        if (data.length == 5){
            data = data + '/';
            document.forms[0].datanasc.value = data;
            return true;
        }
		  
   }
</script>
<div id="conteudo">
	
	<div align="center">
    
    <form action="paciente/PacienteCadastrar.php" method="post">
    <h3 align="center">Cadastrar Paciente</h3>
  	<hr color="#0066FF" size="3px">
    <br />
    <div align="center" style="min-height: 350px; width:auto">
      <table width="850" border="0" align="center">
      <span ><center>Todos os campos são obrigatórios!</center></span>
      <tr>
            <td width="150" align="left"><div align="left">Nome</div></td>
            <td width="700"><input name="nome" type="text" size="60" /></td>
          </tr>
          <tr>
          	<td align="left">Sexo</td>
            <td><select name="sexo" >
                <option value="Masculino">Masculino</option>
                <option value="Feminino">Feminino</option>
            </td>
          </tr>
          <tr>
            <td align="left">Telefone</td>
            <td><input type="text" id="tel" name="fone" OnKeyUp="caractereTelefone(this);" maxlength="13" value="(" /><font size="2" color="#555"> Ex: (XX)0000-0000 </font> </td>
          </tr>
          <tr>
            <td align="left">Celular</td>
            <td><input type="text" name="celular" OnKeyUp="caractereCelular(this);" maxlength="13" value="(" /><font size="2" color="#555"> Ex: (XX)0000-0000 </font></td>
          </tr>
          <tr>
            <td>Email</td>
            <td><input type="text" name="email" size="40"/></td>
          </tr>
          <tr>
            <td align="left">Data de Nascimento</td>
            <td><input name="datanasc" type="text" maxlength="10" id="data" OnKeyUp="caractereData(this);" /> <font size="2" color="#555"> Ex: 12/12/2012 </font> </td>
          </tr>
          <tr>
            <td align="left">RG</td>
            <td><input type="text" id="rg" name="rg" OnKeyUp="mascaraRG(this);" maxlength="11"/><font size="2" color="#555"> Ex: 000.000.000 </font> </td>
          </tr>
          <tr>
            <td align="left">CPF</td>
            <td><input type="text" id="cpf" name="cpf" OnKeyUp="mascaraCpf(this);" maxlength="14"/><font size="2" color="#555"> Ex: 000.000.000-00 </font> </td>
          </tr>
          <tr><td>Estado Civil</td>
          	<td>
          		<select name="estadocivil">
          			<option selected>Selecione...</option>
          			<option value="Solteiro">Solteiro(a)</option>
          			<option value="Casado">Casado(a)</option>
          			<option value="Divorciado">Divorciado(a)</option>
          			<option value="Amasiado">Amasiado(a)</option>
          			<option value="Viúvo">Viúvo(a)</option>
          		</select>
          	</td>
          </tr>
          <tr>
          	<td>Profissão</td>
          	<td><input type="text" name="profissao" size="60"></td>
          </tr>
          <tr>
          	<td>Endereço</td>
          	<td><input type="text" name="endereco" size="60"><font size="2" color="#555"> Ex: Rua Arruda com sete copas, numero 10 </font></td>
          </tr>
          <tr>
          	<td>CEP</td>
          	<td><input type="text" name="cep" maxlength="8"><font size="2" color="#555"> Somente numeros, ex:79370000 </font></td>
          </tr>
          <tr>
          	<td>Bairro</td>
          	<td><input type="text" name="bairro" size="60"></td>
          </tr>
          <tr>
          	<td>Cidade</td>
          	<td><input type="text" name="cidade" size="60"></td>
          </tr>
          <tr>
          	<td>UF</td>
          	<td>
          		<select name="estado" >
          			<?php
							require_once "banco/ConexaoBanco.php";
							$query = mysql_query("SELECT id_estado, uf FROM estado");
							while($lista = mysql_fetch_array($query)) { ?> 
							<option value="<?php echo $lista['id_estado'] ?>"><?php echo $lista['uf'] ?></option>
						<?php } mysql_close();?>
          		</select>
          	
          	</td>
          </tr>
          <tr>
          	<td>Convenio</td>
          	<td><select name="convenio" >
          			<option selected >Selecione...</option>
          			<?php
							require "banco/ConexaoBanco.php";
							$query = mysql_query("SELECT * FROM convenio");
							while($lista = mysql_fetch_array($query)) { ?> 
							<option value="<?php echo $lista['id_convenio']; ?>"><?php echo $lista['conv_nome'] ."-".$lista['conv_tipo']; ?></option>
						<?php } mysql_close();?>
          		</select>
          	
          	</td>
          </tr>
          <tr>
            <td align="left">&nbsp;</td>
            <td><input type="submit" value="Cadastrar" name="enviar" class="botao"/> </td>
          </tr>
        </table>
        </div>
      
    </form>
    
    </div>
</div>
